/**
 * 派牌
 */

cc.Class({
    extends: cc.Component,


    properties: {
        front: cc.SpriteFrame,
        back: cc.SpriteFrame,

        card: {
            set(cardInfo) {
                this.point.string = cardInfo.pointName
                this.suit.spriteFrame = this.suit_frames[cardInfo.suit - 1]
                if (cardInfo.isBlackSuit) {
                    this.point.node.color = cc.Color.BLACK
                } else {
                    this.point.node.color = cc.Color.RED
                }
            }
        },

        bg: cc.Sprite,
        point: cc.Label,
        suit: cc.Sprite,

        suit_frames: {
            default: [],
            type: cc.SpriteFrame
        }
    },

    onLoad() {

    },

    flipFront() {
        this.bg.spriteFrame = this.front
        this.suit.node.active = true
        this.point.node.active = true
    },

    flipBack() {
        this.bg.spriteFrame = this.back
        this.suit.node.active = false
        this.point.node.active = false
    }
})


